package com.zscat.mallplus.oms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zscat.mallplus.oms.entity.OmsOrderItem;
import com.zscat.mallplus.oms.mapper.OmsOrderItemMapper;
import com.zscat.mallplus.oms.service.IOmsOrderItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 订单中所包含的商品 服务实现类
 * </p>
 *
 * @author zscat
 * @since 2019-04-17
 */
@Service
public class OmsOrderItemServiceImpl extends ServiceImpl<OmsOrderItemMapper, OmsOrderItem>
		implements IOmsOrderItemService {

	@Resource
	private OmsOrderItemMapper orderItemMapper;

	/**
	 * 根据订单号查询订单商品
	 *
	 * @param orderId
	 * @return
	 */
	public List<OmsOrderItem> selectOrderItemByOrderId(Long orderId) {
		return orderItemMapper.selectOrderItemByOrderId(orderId);
	}

	/**
	 * 统计用户已购买商品数量
	 */
	@Override
	public int countProductQuantity(Long memberId, Integer orderType, Long flashPromotionProductRelationId) {
		return orderItemMapper.countProductQuantity(memberId, orderType, flashPromotionProductRelationId);
	}
}
